<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Water Pipes</title>

<link rel="stylesheet" href="https://js.arcgis.com/4.0/esri/css/main.css">
<script src="https://js.arcgis.com/4.0/"></script>

<style>
html,
body,
#viewDiv {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
}
</style>

<script>
require([
    "esri/Map",
    "esri/views/SceneView",
    "esri/layers/FeatureLayer",
    "esri/geometry/SpatialReference",
    "esri/geometry/Extent",
    "esri/geometry/Point",
    "esri/Camera",
    "esri/PopupTemplate",
    "esri/renderers/SimpleRenderer",
    "esri/symbols/PathSymbol3DLayer",
    "esri/symbols/LineSymbol3D",
    "dojo/domReady!"
  ], function(
    Map, SceneView, FeatureLayer, SpatialReference, Extent, Point, Camera, PopupTemplate, SimpleRenderer, PathSymbol3DLayer, LineSymbol3D
  ) {

    var initCam = {
      position: {
        x: -12924044,
        y: 5607486,
        z: 1682,
        spatialReference: { wkid: 3857 }
      },
      heading: 54,
      tilt: 79
    };

    var clippingExtent = {
      xmax: -12919647,
      xmin: -12925849,
      ymax: 5609947,
      ymin: 5605928,
      spatialReference: { wkid: 3857 }
    };

    var renderer = new SimpleRenderer({
      symbol: new LineSymbol3D({
        symbolLayers: [new PathSymbol3DLayer({
          material: { color: "blue" }
        })]
      }),
      visualVariables: [
        {
          type: "size",
          field: "Pipe_Diameter",
          valueUnit: "inches"  // converts and renders all data values in inches
        }
      ]
    });

    var pipesLyr = new FeatureLayer({
      url: "http://services1.arcgis.com/ADC8yAk6q5YYgbPJ/arcgis/rest/services/Water_Pipeline_Utilities/FeatureServer/0",
      renderer: renderer,
      popupTemplate: {
        content: "{*}"
      },
      outFields: ["*"],
      elevationInfo: {
        mode: "absolute-height",
        offset: 1600
      }
    });

    var map = new Map({
      basemap: "streets",
      layers: [ pipesLyr ],
      ground: "world-elevation"
    });

    var view = new SceneView({
      container: "viewDiv",
      map: map,
      camera: initCam,
      viewingMode: "local",
      clippingArea: clippingExtent
    });
  });
</script>
</head>

<body>
  <div id="viewDiv"></div>
</body>

</html>